Integrand size = 20, antiderivative size = 171 \[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=-\frac {2 (c+d x)^2 \text {arctanh}\left (e^{i (a+b x)}\right )}{b}-\frac {2 d^2 \cos (a+b x)}{b^3}+\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^2}-\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^2}-\frac {2 d^2 \operatorname {PolyLog}\left (3,-e^{i (a+b x)}\right )}{b^3}+\frac {2 d^2 \operatorname {PolyLog}\left (3,e^{i (a+b x)}\right )}{b^3}-\frac {2 d (c+d x) \sin (a+b x)}{b^2} \]
[Out]
Time = 0.17 (sec) , antiderivative size = 171, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.350, Rules used = {4493, 3377, 2718, 4268, 2611, 2320, 6724} \[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=-\frac {2 (c+d x)^2 \text {arctanh}\left (e^{i (a+b x)}\right )}{b}-\frac {2 d^2 \operatorname {PolyLog}\left (3,-e^{i (a+b x)}\right )}{b^3}+\frac {2 d^2 \operatorname {PolyLog}\left (3,e^{i (a+b x)}\right )}{b^3}-\frac {2 d^2 \cos (a+b x)}{b^3}+\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^2}-\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^2}-\frac {2 d (c+d x) \sin (a+b x)}{b^2}+\frac {(c+d x)^2 \cos (a+b x)}{b} \]
[In]
[Out]
Rule 2320
Rule 2611
Rule 2718
Rule 3377
Rule 4268
Rule 4493
Rule 6724
Rubi steps \begin{align*} \text {integral}& = \int (c+d x)^2 \csc (a+b x) \, dx-\int (c+d x)^2 \sin (a+b x) \, dx \\ & = -\frac {2 (c+d x)^2 \text {arctanh}\left (e^{i (a+b x)}\right )}{b}+\frac {(c+d x)^2 \cos (a+b x)}{b}-\frac {(2 d) \int (c+d x) \cos (a+b x) \, dx}{b}-\frac {(2 d) \int (c+d x) \log \left (1-e^{i (a+b x)}\right ) \, dx}{b}+\frac {(2 d) \int (c+d x) \log \left (1+e^{i (a+b x)}\right ) \, dx}{b} \\ & = -\frac {2 (c+d x)^2 \text {arctanh}\left (e^{i (a+b x)}\right )}{b}+\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^2}-\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^2}-\frac {2 d (c+d x) \sin (a+b x)}{b^2}-\frac {\left (2 i d^2\right ) \int \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right ) \, dx}{b^2}+\frac {\left (2 i d^2\right ) \int \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right ) \, dx}{b^2}+\frac {\left (2 d^2\right ) \int \sin (a+b x) \, dx}{b^2} \\ & = -\frac {2 (c+d x)^2 \text {arctanh}\left (e^{i (a+b x)}\right )}{b}-\frac {2 d^2 \cos (a+b x)}{b^3}+\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^2}-\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^2}-\frac {2 d (c+d x) \sin (a+b x)}{b^2}-\frac {\left (2 d^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,-x)}{x} \, dx,x,e^{i (a+b x)}\right )}{b^3}+\frac {\left (2 d^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,x)}{x} \, dx,x,e^{i (a+b x)}\right )}{b^3} \\ & = -\frac {2 (c+d x)^2 \text {arctanh}\left (e^{i (a+b x)}\right )}{b}-\frac {2 d^2 \cos (a+b x)}{b^3}+\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )}{b^2}-\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )}{b^2}-\frac {2 d^2 \operatorname {PolyLog}\left (3,-e^{i (a+b x)}\right )}{b^3}+\frac {2 d^2 \operatorname {PolyLog}\left (3,e^{i (a+b x)}\right )}{b^3}-\frac {2 d (c+d x) \sin (a+b x)}{b^2} \\ \end{align*}
Time = 0.84 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.29 \[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=\frac {b^2 (c+d x)^2 \log \left (1-e^{i (a+b x)}\right )-b^2 (c+d x)^2 \log \left (1+e^{i (a+b x)}\right )+2 i b d (c+d x) \operatorname {PolyLog}\left (2,-e^{i (a+b x)}\right )-2 i b d (c+d x) \operatorname {PolyLog}\left (2,e^{i (a+b x)}\right )-2 d^2 \operatorname {PolyLog}\left (3,-e^{i (a+b x)}\right )+2 d^2 \operatorname {PolyLog}\left (3,e^{i (a+b x)}\right )+\cos (b x) \left (\left (-2 d^2+b^2 (c+d x)^2\right ) \cos (a)-2 b d (c+d x) \sin (a)\right )-\left (2 b d (c+d x) \cos (a)+\left (-2 d^2+b^2 (c+d x)^2\right ) \sin (a)\right ) \sin (b x)}{b^3} \]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 478 vs. \(2 (159 ) = 318\).
Time = 1.43 (sec) , antiderivative size = 479, normalized size of antiderivative = 2.80
method | result | size |
risch | \(\frac {\left (x^{2} d^{2} b^{2}+2 b^{2} c d x +2 i b \,d^{2} x +b^{2} c^{2}+2 i b c d -2 d^{2}\right ) {\mathrm e}^{i \left (x b +a \right )}}{2 b^{3}}+\frac {\left (x^{2} d^{2} b^{2}+2 b^{2} c d x -2 i b \,d^{2} x +b^{2} c^{2}-2 i b c d -2 d^{2}\right ) {\mathrm e}^{-i \left (x b +a \right )}}{2 b^{3}}-\frac {2 d^{2} a^{2} \operatorname {arctanh}\left ({\mathrm e}^{i \left (x b +a \right )}\right )}{b^{3}}+\frac {2 i c d \operatorname {polylog}\left (2, -{\mathrm e}^{i \left (x b +a \right )}\right )}{b^{2}}+\frac {4 c d a \,\operatorname {arctanh}\left ({\mathrm e}^{i \left (x b +a \right )}\right )}{b^{2}}+\frac {2 d c \ln \left (1-{\mathrm e}^{i \left (x b +a \right )}\right ) a}{b^{2}}-\frac {2 c d \ln \left ({\mathrm e}^{i \left (x b +a \right )}+1\right ) a}{b^{2}}-\frac {2 i d^{2} \operatorname {polylog}\left (2, {\mathrm e}^{i \left (x b +a \right )}\right ) x}{b^{2}}+\frac {2 i d^{2} \operatorname {polylog}\left (2, -{\mathrm e}^{i \left (x b +a \right )}\right ) x}{b^{2}}-\frac {d^{2} \ln \left (1-{\mathrm e}^{i \left (x b +a \right )}\right ) a^{2}}{b^{3}}+\frac {d^{2} \ln \left ({\mathrm e}^{i \left (x b +a \right )}+1\right ) a^{2}}{b^{3}}+\frac {d^{2} \ln \left (1-{\mathrm e}^{i \left (x b +a \right )}\right ) x^{2}}{b}+\frac {2 d^{2} \operatorname {polylog}\left (3, {\mathrm e}^{i \left (x b +a \right )}\right )}{b^{3}}-\frac {d^{2} \ln \left ({\mathrm e}^{i \left (x b +a \right )}+1\right ) x^{2}}{b}-\frac {2 d^{2} \operatorname {polylog}\left (3, -{\mathrm e}^{i \left (x b +a \right )}\right )}{b^{3}}-\frac {2 i d c \operatorname {polylog}\left (2, {\mathrm e}^{i \left (x b +a \right )}\right )}{b^{2}}+\frac {2 d c \ln \left (1-{\mathrm e}^{i \left (x b +a \right )}\right ) x}{b}-\frac {2 d c \ln \left ({\mathrm e}^{i \left (x b +a \right )}+1\right ) x}{b}-\frac {2 c^{2} \operatorname {arctanh}\left ({\mathrm e}^{i \left (x b +a \right )}\right )}{b}\) | \(479\) |
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 562 vs. \(2 (155) = 310\).
Time = 0.30 (sec) , antiderivative size = 562, normalized size of antiderivative = 3.29 \[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=\frac {2 \, d^{2} {\rm polylog}\left (3, \cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) + 2 \, d^{2} {\rm polylog}\left (3, \cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) - 2 \, d^{2} {\rm polylog}\left (3, -\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) - 2 \, d^{2} {\rm polylog}\left (3, -\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) + 2 \, {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2} - 2 \, d^{2}\right )} \cos \left (b x + a\right ) - 2 \, {\left (i \, b d^{2} x + i \, b c d\right )} {\rm Li}_2\left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) - 2 \, {\left (-i \, b d^{2} x - i \, b c d\right )} {\rm Li}_2\left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) - 2 \, {\left (i \, b d^{2} x + i \, b c d\right )} {\rm Li}_2\left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) - 2 \, {\left (-i \, b d^{2} x - i \, b c d\right )} {\rm Li}_2\left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) - {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2}\right )} \log \left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + 1\right ) - {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2}\right )} \log \left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + 1\right ) + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2} i \, \sin \left (b x + a\right ) + \frac {1}{2}\right ) + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) - \frac {1}{2} i \, \sin \left (b x + a\right ) + \frac {1}{2}\right ) + {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + 2 \, a b c d - a^{2} d^{2}\right )} \log \left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + 1\right ) + {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + 2 \, a b c d - a^{2} d^{2}\right )} \log \left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + 1\right ) - 4 \, {\left (b d^{2} x + b c d\right )} \sin \left (b x + a\right )}{2 \, b^{3}} \]
[In]
[Out]
\[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=\int \left (c + d x\right )^{2} \cos {\left (a + b x \right )} \cot {\left (a + b x \right )}\, dx \]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 513 vs. \(2 (155) = 310\).
Time = 0.30 (sec) , antiderivative size = 513, normalized size of antiderivative = 3.00 \[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=\frac {c^{2} {\left (2 \, \cos \left (b x + a\right ) - \log \left (\cos \left (b x + a\right ) + 1\right ) + \log \left (\cos \left (b x + a\right ) - 1\right )\right )} - \frac {2 \, a c d {\left (2 \, \cos \left (b x + a\right ) - \log \left (\cos \left (b x + a\right ) + 1\right ) + \log \left (\cos \left (b x + a\right ) - 1\right )\right )}}{b} + \frac {a^{2} d^{2} {\left (2 \, \cos \left (b x + a\right ) - \log \left (\cos \left (b x + a\right ) + 1\right ) + \log \left (\cos \left (b x + a\right ) - 1\right )\right )}}{b^{2}} - \frac {4 \, d^{2} {\rm Li}_{3}(-e^{\left (i \, b x + i \, a\right )}) - 4 \, d^{2} {\rm Li}_{3}(e^{\left (i \, b x + i \, a\right )}) - 2 \, {\left (-i \, {\left (b x + a\right )}^{2} d^{2} + 2 \, {\left (-i \, b c d + i \, a d^{2}\right )} {\left (b x + a\right )}\right )} \arctan \left (\sin \left (b x + a\right ), \cos \left (b x + a\right ) + 1\right ) - 2 \, {\left (-i \, {\left (b x + a\right )}^{2} d^{2} + 2 \, {\left (-i \, b c d + i \, a d^{2}\right )} {\left (b x + a\right )}\right )} \arctan \left (\sin \left (b x + a\right ), -\cos \left (b x + a\right ) + 1\right ) - 2 \, {\left ({\left (b x + a\right )}^{2} d^{2} + 2 \, {\left (b c d - a d^{2}\right )} {\left (b x + a\right )} - 2 \, d^{2}\right )} \cos \left (b x + a\right ) - 4 \, {\left (i \, b c d + i \, {\left (b x + a\right )} d^{2} - i \, a d^{2}\right )} {\rm Li}_2\left (-e^{\left (i \, b x + i \, a\right )}\right ) - 4 \, {\left (-i \, b c d - i \, {\left (b x + a\right )} d^{2} + i \, a d^{2}\right )} {\rm Li}_2\left (e^{\left (i \, b x + i \, a\right )}\right ) + {\left ({\left (b x + a\right )}^{2} d^{2} + 2 \, {\left (b c d - a d^{2}\right )} {\left (b x + a\right )}\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} + 2 \, \cos \left (b x + a\right ) + 1\right ) - {\left ({\left (b x + a\right )}^{2} d^{2} + 2 \, {\left (b c d - a d^{2}\right )} {\left (b x + a\right )}\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} - 2 \, \cos \left (b x + a\right ) + 1\right ) + 4 \, {\left (b c d + {\left (b x + a\right )} d^{2} - a d^{2}\right )} \sin \left (b x + a\right )}{b^{2}}}{2 \, b} \]
[In]
[Out]
\[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=\int { {\left (d x + c\right )}^{2} \cos \left (b x + a\right ) \cot \left (b x + a\right ) \,d x } \]
[In]
[Out]
Timed out. \[ \int (c+d x)^2 \cos (a+b x) \cot (a+b x) \, dx=\int \cos \left (a+b\,x\right )\,\mathrm {cot}\left (a+b\,x\right )\,{\left (c+d\,x\right )}^2 \,d x \]
[In]
[Out]